import scrapy


class A4399Spider(scrapy.Spider):
    name = "4399"

    start_urls = ["https://www.4399.com/flash/gamehw.htm"]

    def parse(self, response):

        items = response.xpath('//ul[@class="tm_list"]/li')
        for item in items:
            name = item.xpath('./a/b/text()').get()
            img = item.xpath('./a/img/@src | ./a/img/@lz_src').get()
            # print(name, img)
            data = {
                "name": name,
                "img": img
            }

            yield data
